<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>父子组件传值3-驼峰标识</title>
    <script src="../lib/vue_v2.6.14.js"></script>
  </head>
  <body>
    <div id="app">
      <!-- 使用组件时：这种写法是不行的 -->
      <!-- <my-cpn :allMovies="movies"></my-cpn> -->

      <!-- 正确写法： -->
      <my-cpn :all-movies="movies"></my-cpn>
    </div>

    <template id="cpn">
      <div>
        <ul>
          <li v-for="(item, index) in allMovies" :key="index">{{ item }}</li>
        </ul>
      </div>
    </template>
    <script>
      // 子组件
      Vue.component('my-cpn', {
        template: '#cpn',
        props: {
          allMovies: Array
        }
      })

      // 父组件
      const vm = new Vue({
        el: '#app',
        data: {
          movies: ['速度与激情', '拆弹专家', '银河补习班', '敢死队']
        }
      })
    </script>
  </body>
</html>
